﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace Batalha_Estelar
{
    public class PlayerShip : Starship
    {

        public string PlayerID { get; set; }
        
        public int Lifes { get; protected set; }

        public PlayerShip(string playerID, BatalhaEstelar game, Vector2 pos, Vector2 ori, Texture2D tex)
            : base(game, pos, ori, tex)
        {
            PlayerID = playerID;
            Lifes = MyGame.Config.Lifes;
        }

        public override void Update(GameTime gameTime)
        {
            var newPos = CalcNewPosition(gameTime);

            if (this.MyFieldController.Within(newPos))
            {
                this.Posicao = newPos;
            }
        }

        public void DecrementLife()
        {
            Lifes--;
        }

        public void IncrementLife()
        {
            Lifes++;
        }

        public void ResetLifes()
        {
            Lifes = MyGame.Config.Lifes;
        }

        public override bool CanDestroy()
        {
            return (Lifes < 0);
        }

    }
}
